package com.zhu.exercise.pointer;

public class DeleteDuplicateNum26 {

    public int removeDuplicates(int[] nums) {
        if (nums.length==0){
            return 0;
        }
        //双指针查询
        int i =0;
        int j=1;

        for(;j<nums.length;j++){
            if (nums[i]!=nums[j]){
                i++;
                nums[i]=nums[j];
            }
        }
        return i+1;
    }
}
